<?php


namespace app\controller\v1;


use app\model\CommodityLotteryLog;
use app\Request;

/**
 * 活动
 * Class Activity
 * @package app\controller\v1
 */
class Activity
{


    /**
     * 签到
     * @param Request $request
     * @param \app\model\Activity $activity
     * @return \think\Response
     */
    public function Sign(Request $request, \app\model\Activity $activity)
    {
        return $activity->Sign($request);
    }


    /**
     * 签到信息
     * @param Request $request
     * @param \app\model\Activity $activity
     * @return int
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function signMsg(Request $request, \app\model\Activity $activity)
    {
        return $activity->signMsg($request->data);
    }


    /**
     * 视频回调接口
     * @param Request $request
     * @param \app\model\Activity $activity
     * @return mixed
     * @throws \Psr\SimpleCache\InvalidArgumentException
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function video(Request $request, \app\model\Activity $activity)
    {
//        file_put_contents('/www/wwwroot/poly-select-php-interface/video.txt', var_export($_GET, true) . '--------' . date('H:i:s') . PHP_EOL, FILE_APPEND);
        return $activity->video($request->user_id);
    }



    public function LotteryLog(\think\Request $request, CommodityLotteryLog $commodityLotteryLog)
    {
        return $commodityLotteryLog->LotteryLog($request);
    }


    /**
     * 抽奖前置信息
     * @param \think\Request $request
     * @param CommodityLotteryLog $commodityLotteryLog
     * @return mixed
     */
    public function LotteryMsg(\think\Request $request, CommodityLotteryLog $commodityLotteryLog){
        return $commodityLotteryLog->LotteryMsg($request);
    }

    /**
     * 抽奖
     * @param \think\Request $request
     * @param CommodityLotteryLog $commodityLotteryLog
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function lottery(\think\Request $request, CommodityLotteryLog $commodityLotteryLog)
    {
        return $commodityLotteryLog->lottery($request);
    }


    /**
     * 中奖公告
     * @param \think\Request $request
     * @param CommodityLotteryLog $commodityLotteryLog
     * @return mixed
     * @throws \think\db\exception\DbException
     */
    public function WinnerLog(\think\Request $request, CommodityLotteryLog $commodityLotteryLog)
    {
        return $commodityLotteryLog->WinnerLog($request);
    }

}